sap.ui.define([
    "sap/ui/core/mvc/Controller",
    "sap/m/MessageToast"
], function(Controller, MessageToast) {
    'use strict';
    return Controller.extend("ui5.walkthrough.controller.App", {

        onInit: function() {
            this.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());
        },

        // onInit: function() {
        //     const oData = {
        //         recipient : {
        //            name : "nihao",
        //            name1 : "jzj"
        //         },
        //      };
        //      const oModel = new JSONModel(oData);
        //      this.getView().setModel(oModel);

        //      // set i18n model on view
        //     const i18nModel = new ResourceModel({
        //         bundleName: "ui5.walkthrough.i18n.i18n"
        //     });
        //     this.getView().setModel(i18nModel, "i18n");
        // },

		onButtonSayHelloPress: function(oEvent) {
			const oBundle = this.getView().getModel("i18n").getResourceBundle();
            const sRecipient = this.getView().getModel().getProperty("/recipient/name");
            const sRecipient1 = this.getView().getModel().oData.recipient.name1;
            const sMsg = oBundle.getText("helloMsg", [sRecipient, sRecipient1]);

            MessageToast.show(sMsg);
            console.log(this.getView().getModel('invoiceRemote'));
            // console.log(this.getView().getModel()["oData"]["recipient"]["name"]);
		},
    });
});